package org.example.restful.common;

import lombok.Data;

@Data
public class R<T> {
    private Integer code;
    private String message;
    //因为可能会又各种数据，所以用Object类型
    private T data;

    public static <T> R<T> success(T object) {
        R<T> r = new R<T>();
        r.data = object;
        r.code = 200;//成功的状态码
        r.message = "操作成功";
        return r;
    }

    public static R success() {
        R r = new R<>();
        r.code = 200;//成功的状态码
        r.message = "操作成功";
        return r;
    }

}
